import Array
import System(getArgs)
import Test

size = 10000

data Queue t = Queue (Array Int t) Int Int

makeTup (Queue a t h) = (a, t, h)

newQueue = Queue (array(0,size)(zip[0..size](repeat 0))) 0 0

--[0 | i <- [0..size]]

push x (Queue a t h) = (Queue (a//[(h,x)]) t (mod (h+1) ((snd (bounds a)) + 1)))

remove (Queue a t h) = (Queue a (mod (t+1) ((snd (bounds a)) + 1)) h)

peek (Queue a t h) = a!t

main = do args <- getArgs
          writeFile "result.dat" ("Queue 3 Results:" ++ "\n")
          --Test.multiTest push remove newQueue makeTup (rInt (head args)) (rInt (head (tail args)))
          let q = Test.pushntimes push newQueue (rInt (head args))
          writeFile "out.dat" (show (makeTup q))
          --Test.removeTest remove q makeTup (rInt (head args)) (rInt (head (tail args))) 0
          --Test.pushTest push peek newQueue makeTup (rInt (head args)) (rInt (head (tail args))) 0
          Test.pushremovenTest push remove newQueue makeTup (rInt (head args)) (rInt (head (tail args))) 0